<?php
/**
 * Created by PhpStorm.
 * User: g
 * Date: 2017/4/27
 * Time: 14:58
 */

namespace app\front\controller;


use app\common\controller\Base;

class Registration extends Base
{
    public function realreg(){
        if(IS_POST){
            $post = input('');
            $post['createdate'] = date('Y-m-d H:i:s');
            $post['audit'] = 2;
            $post['contact'] = $post['contact_x'].$post['contact_m'];
            $res = model("AccountRegistration")->allowField(true)->data($post)->save();
            if($res){
                $this->success("注册成功，请等待审核！",url("realreg"));
            }else{
                $this->error("注册失败，请重试！",url("realreg"));
            }
        }else{
            return $this->fetch();
        }

    }
    public function vilreg(){
        if(IS_POST){
            $post = input('');
            $post['createdate'] = date('Y-m-d H:i:s');
            $post['audit'] = 2;
            $post['contact'] = $post['contact_x'].$post['contact_m'];
            $res = model("AccountRegistration")->allowField(true)->data($post)->save();
            if($res){
                $this->success("注册成功，请等待审核！",url("vilreg"));
            }else{
                $this->error("注册失败，请重试！",url("vilreg"));
            }
        }else{
            return $this->fetch();
        }
    }

    public function agentreg(){
        if(IS_POST){
            $post = input('');
            $post['createdate'] = date('Y-m-d H:i:s');
            $post['audit'] = 2;
            $post['contact'] = $post['contact_x'].$post['contact_m'];
            $res = model("AccountRegistration")->allowField(true)->data($post)->save();
            if($res){
                $this->success("注册成功，请等待审核！",url("agentreg"));
            }else{
                $this->error("注册失败，请重试！",url("agentreg"));
            }
        }else{
            return $this->fetch();
        }
    }
}
